{$CLEO}

0A95: enable_thread_saving

const
  _camera_rot_z = 3@
  _get_param = 10@
  _camera_pos_x = 14@
  _camera_pos_y = 23@
  _camera_pos_z = 24@
  _camera_rot_x = 25@
  _camera_rot_y = 26@
  _value_1 = 27@
  _param = 28@
  _value_2 = 29@
  _segment_id = 30@
  _OFFSET_STEP = 31@
  __PX = 0@
  __PY = 1@
  __PZ = 2@
  _MODE = 8@
  _count = 6@
  _items = 11@
  _pos_y = 12@
  _cent = 15@
end

thread 'CAMT'

0adf: "sed0m" "Camera Tool v1.5"
0adf: "sed1" "Camera Pos x"
0adf: "sed2" "Camera Pos y"
0adf: "sed3" "Camera Pos z"
0adf: "sed4" "Camera Rot X"
0adf: "sed5" "Camera Rot Y"
0adf: "sed6" "Camera Rot z"
0adf: "sed7" "Offset Step"
0adf: "sed8" "Save Param"
0adf: "sed9" "Camera Restore"
0adf: "sedA" "Camera Type"
0adf: "sedb" "~y~~h~free"
0adf: "sedc" "~y~~h~attached"
0adf: "valuea" "(~1~)"
0adf: "valuem" "(~1~ ~1~)"

                                            
if 8AF0: _segment_id      = get_int_from_ini_file "CLEO\ATTACH_CAMERA.INI" section "SEGID" key "to"                                    
then 0AF1: write_int 0 to_ini_file "CLEO\ATTACH_CAMERA.INI" section "SEGID" key "to"     
end
if 8AF0: _segment_id      = get_int_from_ini_file "CLEO\free_CAMERA.INI" section "SEGID" key "to"                                    
then 0AF1: write_int 0 to_ini_file "CLEO\free_CAMERA.INI" section "SEGID" key "to"     
end
_MODE = 1

:starth
repeat
repeat
wait 0
until if Player.Defined(0)
until if 0ab0: 77 
//Player.CanMove(0) = False
 
_items = 1
_OFFSET_STEP = 0.1

var
   _count        :int
   _items        :int
   _OFFSET_STEP  :FLOAT
   _camera_pos_x :FLOAT         
   _camera_pos_y :FLOAT         
   _camera_pos_z :FLOAT         
   _camera_rot_x :FLOAT         
   _camera_rot_y :FLOAT         
   _camera_rot_z :FLOAT         
end

while true
    wait 0
    _pos_y = 200.0
    for _count = 0 to 10 step 1
        0085: _cent = _pos_y
        _cent -= 4.0
        038E: draw_box_position 90.0 _pos_y size 140.0 14.0 RGBA 0 0 0 150
        if _count == 0
        then                                                                                                       
            033F: set_text_draw_letter_size 0.2  0.8                                                                                                                                                                        
            060D: draw_text_shadow 1   0  0  0  200                                                                                                                                                                         
            0340: set_text_draw_RGBA 255  255  0  200                                                                                                                                                                     
            0349: set_text_draw_font 2                                                                                                                                                                                      
            0343: set_text_draw_linewidth 700.0                                                                                                                                                                             
            033E: set_draw_text_position 24.0  _cent  "sed0m"                                                                              
        end                  
        0AD3: 19@v = format "sed%x" _count     
        060D: draw_text_shadow 1 rgba 50 50 200 150                                                                                                
        0343: set_text_draw_linewidth 640.0                                                                                                                        
        081C: draw_text_outline 1 RGBA 0 0 0 100                                                                                                                   
        033F: set_text_draw_letter_size 0.2 0.9                                                       
            081C: draw_text_outline 1 RGBA 0 0 0 100                                                      
            0343: set_text_draw_linewidth 1000.0                                            
        033E: set_draw_text_position 23.0 _cent GXT 19@v
        IF _count == 1
        THEN 0087: _get_param = _camera_pos_x
        END
        IF _count == 2
        THEN 0087: _get_param = _camera_pos_y
        END
        IF _count == 3
        THEN 0087: _get_param = _camera_pos_z
        END
        IF _count == 4
        THEN 0087: _get_param = _camera_rot_x
        END
        IF _count == 5
        THEN 0087: _get_param = _camera_rot_y
        END
        IF _count == 6
        THEN 0087: _get_param = _camera_rot_z
        END
        IF _count == 7
        THEN 0087: _get_param = _OFFSET_STEP
        END
        IF AND
            _count > 0
            8 > _count
        THEN
            0092: _value_1 = float _get_param to_integer                                                              
            0093: _param = integer _value_1 to_float                                                              
            0063: _get_param -= _param // (float)                                                                   
            _get_param *= 100.0                                                                                  
            0092: _value_2 = float _get_param to_integer                                                              
            if 0 > _value_2                                                                                     
            THEN _value_2 *= -1                                                                                     
            END                                                                          
            033F: set_text_draw_letter_size 0.2 0.8                                                       
            081C: draw_text_outline 1 RGBA 0 0 0 100                                                      
            0343: set_text_draw_linewidth 1000.0                                                          
            045B: draw_text_2numbers 130.0 _cent GXT "valuem" numbers _value_1 _value_2
        END
        if _count == 8
        then
            IF _MODE == 1
            THEN 0AF0: _segment_id      = get_int_from_ini_file "CLEO\FREE_CAMERA.INI" section "SEGID" key "to"
            ELSE 0AF0: _segment_id      = get_int_from_ini_file "CLEO\ATTACH_CAMERA.INI" section "SEGID" key "to"
            END                                                                                                      
            033F: set_text_draw_letter_size 0.2 0.8                                                       
            081C: draw_text_outline 1 RGBA 0 0 0 100                                                      
            0343: set_text_draw_linewidth 1000.0                                                                                                                                                                             
            045A: set_draw_text_positionWithNumber 130.0  _cent  "valuea" _segment_id                                                                     
        end
        IF _count == 10
        THEN
            IF _MODE == 1
            THEN 
                033F: set_text_draw_letter_size 0.2  0.8                                                                                                                                                                        
                060D: draw_text_shadow 1   0  0  0  200                                                                                                                                                                         
                0340: set_text_draw_RGBA 255  255  0  200                                                                                                                                                                     
                0349: set_text_draw_font 2                                                                                                                                                                                      
                0343: set_text_draw_linewidth 700.0                                                                                                                                                                             
                033E: set_draw_text_position 110.0  _cent  "sedb"
            ELSE
                033F: set_text_draw_letter_size 0.2  0.8                                                                                                                                                                        
                060D: draw_text_shadow 1   0  0  0  200                                                                                                                                                                         
                0340: set_text_draw_RGBA 255  255  0  200                                                                                                                                                                     
                0349: set_text_draw_font 2                                                                                                                                                                                      
                0343: set_text_draw_linewidth 700.0                                                                                                                                                                             
                033E: set_draw_text_position 110.0  _cent  "sedc"
            END                                                                              
        end                                                                                                                          
        if _count == _items
        then 038E: draw_box_position 90.0 _pos_y size 140.0 14.0 RGBA 150 150 150 150
        end
        _pos_y += 14.0
    end
    03F0: enable_text_draw 0
    0494: get_joystick 0 direction_offset_to 16@ 17@ 18@ 18@
    IF and
        17@ > 0
        7@ == false                                                                                                                                                                                                           
    THEN 7@ = true
        if _items >= 10
        then _items = 1
        else _items++
        end
    end
    IF and
        0 > 17@
        7@ == false                                                                                                                                                                                                               
    THEN 7@ = true
        if 2 > _items
        then _items = 10
        else _items--
        end
    end
    if and
      not 17@ > 0
      not 0 > 17@
    then 7@ = false
    end          
    0A4A: store_joystick_X_offset_to 4@ Y_offset_to 5@                    
    9@ = Actor.Angle($PLAYER_ACTOR)                                       
    0063: 9@ -= 4@ // (float)                                             
    if _items == 1 //X                                                                                                                                                                                                                    
    then                                                                                                                                                                                                                              
        IF 16@ > 0                                                                                                                                                                                                           
        THEN _camera_pos_x += _OFFSET_STEP                                                                                                                                                                                                      
            ELSE IF 0 > 16@                                                                                                                                                                                                  
            THEN _camera_pos_x -= _OFFSET_STEP                                                                                                                                                                                                    
            END                                                                                                                                                                                                                      
        END                                                                                                                                                                                                                           
    end
    if _items == 2 //Y                                                                                                                                                                                                                  
    then                                                                                                                                                                                                                              
        IF 16@ > 0                                                                                                                                                                                                           
        THEN _camera_pos_y += _OFFSET_STEP                                                                                                                                                                                                           
            ELSE IF 0 > 16@                                                                                                                                                                                                  
            THEN _camera_pos_y -= _OFFSET_STEP                                                                                                                                                                                                     
            END                                                                                                                                                                                                                      
        END                                                                                                                                                                                                                           
    end                   
    if _items == 3 //Z                                                                                                                                                                                                                   
    then                                                                                                                                                                                                                              
        IF 16@ > 0                                                                                                                                                                                                           
        THEN _camera_pos_z -= _OFFSET_STEP                                                                                                                                                                                                        
                                                                                                                                                  
            ELSE IF 0 > 16@                                                                                                                                                                                                  
            THEN _camera_pos_z += _OFFSET_STEP                                                                                                                                                                                                     
                                                                                                                                                   
            END                                                                                                                                                                                                                      
        END                                                                                                                                                                                                                           
    end                   
    if _items == 4 //ROT X                                                                                                                                                                                                                   
    then                                                                                                                                                                                                                              
        IF 16@ > 0                                                                                                                                                                                                           
        THEN _camera_rot_x += _OFFSET_STEP                                                                                                                                                                                                      
                                                                                                                                                  
            ELSE IF 0 > 16@                                                                                                                                                                                                  
            THEN _camera_rot_x -= _OFFSET_STEP                                                                                                                                                                                                 
                                                                                                                                                   
            END                                                                                                                                                                                                                      
        END                                                                                                                                                                                                                           
    end
    if _items == 5 //ROT Y                                                                                                                                                                                                                   
    then                                                                                                                                                                                                                              
        IF 16@ > 0                                                                                                                                                                                                           
        THEN _camera_rot_y += _OFFSET_STEP                                                                                                                                                                                                      
                                                                                                                                                  
            ELSE IF 0 > 16@                                                                                                                                                                                                  
            THEN _camera_rot_y -= _OFFSET_STEP                                                                                                                                                                                                 
                                                                                                                                                   
            END                                                                                                                                                                                                                      
        END                                                                                                                                                                                                                           
    end
    if _items == 6 //ROT Z                                                                                                                                                                                                                   
    then                                                                                                                                                                                                                              
        IF 16@ > 0                                                                                                                                                                                                           
        THEN _camera_rot_z += _OFFSET_STEP                                                                                                                                                                                                     
                                                                                                                                                  
            ELSE IF 0 > 16@                                                                                                                                                                                                  
            THEN _camera_rot_z -= _OFFSET_STEP                                                                                                                                                                                              
                                                                                                                                                   
            END                                                                                                                                                                                                                      
        END                                                                                                                                                                                                                           
    end
    if _items == 7 //ROT Z                                                                                                                                                                                                                   
    then 
        IF 16@ > 0     
		THEN 
            if 33@ >= 50
		    then 33@ = 0
                IF NOT _OFFSET_STEP >= 5.0                     
                THEN _OFFSET_STEP += 0.01                      
                END
            end                                            
		    ELSE IF 0 > 16@ 
		    THEN 
                if 33@ >= 50
		        then 33@ = 0
                    IF _OFFSET_STEP > 0.01
                    THEN _OFFSET_STEP -= 0.01  
                    END
                end 
		    END
		END                     
	END	    
	if _items == 8                                                                                                                                                                                                                    
    then                                                                                                                                                                                                                              
        if and                                                                                                          
            00E1:   not player 0 pressed_key 16                                                                         
            13@ == false                                                                                                
        then 13@ = true 
            IF _MODE == 1
            THEN                                                                                                
                if 0AF0: _segment_id      = get_int_from_ini_file "CLEO\FREE_CAMERA.INI" section "SEGID" key "to"                                    
                then                                                                                                                             
                    if NOT _segment_id >= 50 //MAX SEGMENTS                                                                                      
                    then                                                                                                                         
                        _segment_id += 1 //NEXT SEGMENT                                                                                          
                        0AF1: write_int _segment_id to_ini_file "CLEO\FREE_CAMERA.INI" section "SEGID" key "to"                                      
                        if 0AF0: _segment_id      = get_int_from_ini_file "CLEO\FREE_CAMERA.INI" section "SEGID" key "to"                            
                        then                                                                                                                     
                            0AD3: 19@v = format "sed%x" _segment_id                                                                              
                            0ACD: "CAMERA OFFSET SAVE" 500                                                                                       
                            0AF3: write_float _camera_pos_x to_ini_file "CLEO\FREE_CAMERA.INI" section 19@v key "POS_X"                              
                            0AF3: write_float _camera_pos_y to_ini_file "CLEO\FREE_CAMERA.INI" section 19@v key "POS_Y"                              
                            0AF3: write_float _camera_pos_z to_ini_file "CLEO\FREE_CAMERA.INI" section 19@v key "POS_Z"                              
                            0AF3: write_float _camera_rot_x to_ini_file "CLEO\FREE_CAMERA.INI" section 19@v key "POINT_x"                            
                            0AF3: write_float _camera_rot_y to_ini_file "CLEO\FREE_CAMERA.INI" section 19@v key "POINT_y"                            
                            0AF3: write_float _camera_rot_z to_ini_file "CLEO\FREE_CAMERA.INI" section 19@v key "POINT_z"                            
                        ELSE 0ACD: "~R~section SEGMENT ID NOT FUND" 1000                                                                         
                        END                                                                                                                      
                    ELSE 0ACD: "~R~YOU HAVE MAX SEGMENT ID" 1000                                                                                 
                    END                                                                                                                          
                ELSE 0ACD: "~R~Section SEGMENT ID NOT FUND" 1000                                                                                 
                END
            ELSE
                IF _MODE == 2
                THEN
                    if 0AF0: _segment_id      = get_int_from_ini_file "CLEO\ATTACH_CAMERA.INI" section "SEGID" key "to"                                            
                    then                                                                                                                                  
                        if NOT _segment_id >= 50 //MAX SEGMENTS                                                                                           
                        then                                                                                                                              
                            _segment_id += 1 //NEXT SEGMENT                                                                                               
                            0AF1: write_int _segment_id to_ini_file "CLEO\ATTACH_CAMERA.INI" section "SEGID" key "to"                                              
                            if 0AF0: _segment_id      = get_int_from_ini_file "CLEO\ATTACH_CAMERA.INI" section "SEGID" key "to"                                    
                            then                                                                                                                          
                                0AD3: 19@v = format "sed%x" _segment_id                                                                                   
                                0ACD: "CAMERA OFFSET SAVE" 500                                                                                            
                                0AF3: write_float _camera_pos_x to_ini_file "CLEO\ATTACH_CAMERA.INI" section 19@v key  "offset_X"                                  
                                0AF3: write_float _camera_pos_y to_ini_file "CLEO\ATTACH_CAMERA.INI" section 19@v key "offset_Y"                                   
                                0AF3: write_float _camera_pos_z to_ini_file "CLEO\ATTACH_CAMERA.INI" section 19@v key  "offset_Z"                                  
                                0AF3: write_float _camera_rot_x to_ini_file "CLEO\ATTACH_CAMERA.INI" section 19@v key "rot_x"                                      
                                0AF3: write_float _camera_rot_y to_ini_file "CLEO\ATTACH_CAMERA.INI" section 19@v key "rot_y"                                      
                                0AF3: write_float _camera_rot_z to_ini_file "CLEO\ATTACH_CAMERA.INI" section 19@v key "rot_z"                                      
                            ELSE 0ACD: "~R~section SEGMENT ID NOT FUND" 1000                                                                              
                            END                                                                                                                           
                        ELSE 0ACD: "~R~YOU HAVE MAX SEGMENT ID" 1000                                                                                      
                        END                                                                                                                               
                    ELSE 0ACD: "~R~section SEGMENT ID NOT FUND" 1000                                                                                      
                    END
                END
            END                                                                                                                                   
        end                                                                                                             
        if 80E1:   not player 0 pressed_key 16                                                                          
        then 13@ = false                                                                                                
        end                                                                                                                                                                                              
    end
    if _items == 9                                                                                                                                                                                                                    
    then                                                                                                                                                                                                                              
        if and                                                                                                          
            00E1:   not player 0 pressed_key 16                                                                         
            13@ == false                                                                                                
        then 13@ = true                                                                                                 
            CAMERA.Restore_WithJumpCut                                                                                
        end                                                                                                             
        if 80E1:   not player 0 pressed_key 16                                                                          
        then 13@ = false                                                                                                
        end                                                                                                                                                                                              
    end
    if _items == 10 //ROT Z                                                                                                                                                                                                                   
    then
        if and                                                                                                          
            00E1:   not player 0 pressed_key 16                                                                         
            13@ == false                                                                                                
        then 13@ = true                                                                                                 
            if _MODE == 1
            then _MODE = 2
                goto @set1
            else _MODE = 1
                goto @set2
            end                                                                                
        end                                                                                                             
        if 80E1:   not player 0 pressed_key 16                                                                          
        then 13@ = false                                                                                                
        end                     
    END	    
    IF _MODE == 1
    THEN
        if or                                                                                                                                                    
        _items == 1                                                                                                                                              
        _items == 2                                                                                                                                              
        _items == 3                                                                                                                                              
        _items == 4                                                                                                                                              
        _items == 5                                                                                                                                              
        _items == 6                                                                                                                                              
        then                                                                                                                                                     
            if or                                                                                                                                                
            16@ > 0                                                                                                                                              
            0 > 16@                                                                                                                                              
            then 
                :set1                                                                                                                                                
                5@ /= 200.0                                                                                                                                      
                005B: _camera_rot_z += 5@ // (float)                                                                                                             
                4@ /= 200.0                                                                                                                                      
                005B: _camera_rot_y += 4@ // (float)                                                                                                             
                04C4: store_coords_to __PX __PY __PZ  from_actor $PLAYER_ACTOR with_offset _camera_pos_x _camera_pos_y _camera_pos_z                             
                Camera.SetPosition(__PX __PY __PZ , 0.0, 0.0, 0.0)                                                                                               
                04C4: store_coords_to __PX __PY __PZ  from_actor $PLAYER_ACTOR with_offset _camera_rot_x _camera_rot_y _camera_rot_z                             
                Camera.PointAt(__PX __PY __PZ , 2)                                                                                                               
            end                                                                                                                                                  
        end                                                                                                                                                      
    ELSE
        IF _MODE == 2
        THEN
            if or                                                                                                                                                                                   
            _items == 1                                                                                                                                                                             
            _items == 2                                                                                                                                                                             
            _items == 3                                                                                                                                                                             
            _items == 4                                                                                                                                                                             
            _items == 5                                                                                                                                                                             
            _items == 6                                                                                                                                                                             
            then                                                                                                                                                                                    
                if or                                                                                                                                                                               
                16@ > 0                                                                                                                                                                             
                0 > 16@                                                                                                                                                                             
                then
                    :set2                                                                                                                                                                                
                    067C: put_camera_on_actor $PLAYER_ACTOR offset _camera_pos_x _camera_pos_y _camera_pos_z rotation _camera_rot_x _camera_rot_y _camera_rot_z tilt 0.0 switchstyle 2              
                    5@ /= 200.0                                                                                                                                                                     
                    005B: _camera_rot_z += 5@ // (float)                                                                                                                                            
                    4@ /= 200.0                                                                                                                                                                     
                    005B: _camera_rot_y += 4@ // (float)                                                                                                                                            
                    067C: put_camera_on_actor $PLAYER_ACTOR offset _camera_pos_x _camera_pos_y _camera_pos_z rotation _camera_rot_x _camera_rot_y _camera_rot_z tilt 0.0 switchstyle 2              
                end                                                                                                                                                                                 
            end
        END
    END                                                                                                                                                                                     
    if 0ab0: 55
    then 03F0: enable_text_draw 0
        Camera.SetBehindPlayer
        Camera.Restore_WithJumpCut
        Player.CanMove(0) = true
        goto @starth
    end                                                                                                         
end


    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    















 


